<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>qLibc: containers/qhashtbl.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">qLibc
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('qhashtbl_8c.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">qhashtbl.c File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Hash-table container implementation.  
<a href="#details">More...</a></p>

<p><a href="qhashtbl_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a3a9cf947d23f63b5a86e4ab6f815c4fd"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a3a9cf947d23f63b5a86e4ab6f815c4fd">DEFAULT_INDEX_RANGE</a>&#160;&#160;&#160;(1000)</td></tr>
<tr class="separator:a3a9cf947d23f63b5a86e4ab6f815c4fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a7a2314dcb8381b4599e8050becad2268"><td class="memItemLeft" align="right" valign="top">qhashtbl_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a> (size_t range, int options)</td></tr>
<tr class="memdesc:a7a2314dcb8381b4599e8050becad2268"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize hash table.  <br /></td></tr>
<tr class="separator:a7a2314dcb8381b4599e8050becad2268"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa156cfc5dbc28dd5c082dbf0d354fd5f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#aa156cfc5dbc28dd5c082dbf0d354fd5f">qhashtbl_put</a> (qhashtbl_t *tbl, const char *name, const void *data, size_t size)</td></tr>
<tr class="memdesc:aa156cfc5dbc28dd5c082dbf0d354fd5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;<a class="el" href="qhttpclient_8c.html#ae9ac3bd43c11509c0cbd8fb284bf13eb" title="qhttpclient-&gt;put(): Uploads a file to the remote host using PUT method.">put()</a>: Put an object into this table.  <br /></td></tr>
<tr class="separator:aa156cfc5dbc28dd5c082dbf0d354fd5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8832c9892ab3a4057dcf72589f00685a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a8832c9892ab3a4057dcf72589f00685a">qhashtbl_putstr</a> (qhashtbl_t *tbl, const char *name, const char *str)</td></tr>
<tr class="memdesc:a8832c9892ab3a4057dcf72589f00685a"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;putstr(): Put a string into this table.  <br /></td></tr>
<tr class="separator:a8832c9892ab3a4057dcf72589f00685a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abfea47ba4675f272f0ecaf5041987f8b"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#abfea47ba4675f272f0ecaf5041987f8b">qhashtbl_putstrf</a> (qhashtbl_t *tbl, const char *name, const char *format,...)</td></tr>
<tr class="memdesc:abfea47ba4675f272f0ecaf5041987f8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;putstrf(): Put a formatted string into this table.  <br /></td></tr>
<tr class="separator:abfea47ba4675f272f0ecaf5041987f8b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6a51c2268d057d6de84c0e3b661ba60"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#ae6a51c2268d057d6de84c0e3b661ba60">qhashtbl_putint</a> (qhashtbl_t *tbl, const char *name, const int64_t num)</td></tr>
<tr class="memdesc:ae6a51c2268d057d6de84c0e3b661ba60"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;putint(): Put a integer into this table as string type.  <br /></td></tr>
<tr class="separator:ae6a51c2268d057d6de84c0e3b661ba60"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adb6639e5a035c6c82d558f75d094bb8a"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#adb6639e5a035c6c82d558f75d094bb8a">qhashtbl_get</a> (qhashtbl_t *tbl, const char *name, size_t *size, bool newmem)</td></tr>
<tr class="memdesc:adb6639e5a035c6c82d558f75d094bb8a"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;<a class="el" href="qhttpclient_8c.html#af16a3eb0912e8b5d4896466632d9c843" title="qhttpclient-&gt;get(): Downloads a file from the remote host using GET method.">get()</a>: Get an object from this table.  <br /></td></tr>
<tr class="separator:adb6639e5a035c6c82d558f75d094bb8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd67a76b916bb5cd4b0aae2d37b23c9a"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#acd67a76b916bb5cd4b0aae2d37b23c9a">qhashtbl_getstr</a> (qhashtbl_t *tbl, const char *name, const bool newmem)</td></tr>
<tr class="memdesc:acd67a76b916bb5cd4b0aae2d37b23c9a"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;getstr(): Finds an object and returns as string type.  <br /></td></tr>
<tr class="separator:acd67a76b916bb5cd4b0aae2d37b23c9a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28ecdb8684c5f059ae179d78e4d4b02a"><td class="memItemLeft" align="right" valign="top">int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a28ecdb8684c5f059ae179d78e4d4b02a">qhashtbl_getint</a> (qhashtbl_t *tbl, const char *name)</td></tr>
<tr class="memdesc:a28ecdb8684c5f059ae179d78e4d4b02a"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;getint(): Finds an object with given name and returns as integer type.  <br /></td></tr>
<tr class="separator:a28ecdb8684c5f059ae179d78e4d4b02a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0e16876f85af045651b4e14a98760ee6"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a0e16876f85af045651b4e14a98760ee6">qhashtbl_remove</a> (qhashtbl_t *tbl, const char *name)</td></tr>
<tr class="memdesc:a0e16876f85af045651b4e14a98760ee6"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;remove(): Remove an object from this table.  <br /></td></tr>
<tr class="separator:a0e16876f85af045651b4e14a98760ee6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c30813d4a8dbf3dbb23c394d7799393"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a5c30813d4a8dbf3dbb23c394d7799393">qhashtbl_getnext</a> (qhashtbl_t *tbl, qhashtbl_obj_t *obj, const bool newmem)</td></tr>
<tr class="memdesc:a5c30813d4a8dbf3dbb23c394d7799393"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;getnext(): Get next element.  <br /></td></tr>
<tr class="separator:a5c30813d4a8dbf3dbb23c394d7799393"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a78ff1327078f1aac4294cad1c4e1953c"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a78ff1327078f1aac4294cad1c4e1953c">qhashtbl_size</a> (qhashtbl_t *tbl)</td></tr>
<tr class="memdesc:a78ff1327078f1aac4294cad1c4e1953c"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;size(): Returns the number of keys in this hashtable.  <br /></td></tr>
<tr class="separator:a78ff1327078f1aac4294cad1c4e1953c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26a4dc238b680364bf498e23ec2e1553"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a26a4dc238b680364bf498e23ec2e1553">qhashtbl_clear</a> (qhashtbl_t *tbl)</td></tr>
<tr class="memdesc:a26a4dc238b680364bf498e23ec2e1553"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;clear(): Clears this hashtable so that it contains no keys.  <br /></td></tr>
<tr class="separator:a26a4dc238b680364bf498e23ec2e1553"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a166533cb5a45f6d2e458ff36807401f8"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a166533cb5a45f6d2e458ff36807401f8">qhashtbl_debug</a> (qhashtbl_t *tbl, FILE *out)</td></tr>
<tr class="memdesc:a166533cb5a45f6d2e458ff36807401f8"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;debug(): Print hash table for debugging purpose  <br /></td></tr>
<tr class="separator:a166533cb5a45f6d2e458ff36807401f8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a87be8b838dc11139075428254493e8b3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a87be8b838dc11139075428254493e8b3">qhashtbl_lock</a> (qhashtbl_t *tbl)</td></tr>
<tr class="memdesc:a87be8b838dc11139075428254493e8b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;lock(): Enter critical section.  <br /></td></tr>
<tr class="separator:a87be8b838dc11139075428254493e8b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a35de9472338a15c45c1e7ffa9935b701"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a35de9472338a15c45c1e7ffa9935b701">qhashtbl_unlock</a> (qhashtbl_t *tbl)</td></tr>
<tr class="memdesc:a35de9472338a15c45c1e7ffa9935b701"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;unlock(): Leave critical section.  <br /></td></tr>
<tr class="separator:a35de9472338a15c45c1e7ffa9935b701"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a71fdf75c0db2e15984195f55b5bc27"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qhashtbl_8c.html#a4a71fdf75c0db2e15984195f55b5bc27">qhashtbl_free</a> (qhashtbl_t *tbl)</td></tr>
<tr class="memdesc:a4a71fdf75c0db2e15984195f55b5bc27"><td class="mdescLeft">&#160;</td><td class="mdescRight">qhashtbl-&gt;free(): De-allocate hash table  <br /></td></tr>
<tr class="separator:a4a71fdf75c0db2e15984195f55b5bc27"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Hash-table container implementation. </p>
<p>qhashtbl implements a hash table, which maps keys to values. Key is a unique string and value is any non-null object. The creator <a class="el" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268" title="Initialize hash table.">qhashtbl()</a> has a parameter that affect its performance: initial hash range. The hash range is the number of slots(pointers) in the hash table. in the case of a hash collision, a single slots stores multiple elements using linked-list structure, which must be searched sequentially. So lower range than the number of elements decreases the space overhead but increases the number of hash collisions and consequently it increases the time cost to look up an element.</p>
<div class="fragment"><div class="line">[Internal Structure Example <span class="keywordflow">for</span> 10-slot hash table]</div>
<div class="line"> </div>
<div class="line">RANGE    NAMED-OBJECT-LIST</div>
<div class="line">=====    =================</div>
<div class="line">[ 0 ] -&gt; [hash=320,key3=value] -&gt; [hash=210,key5=value] -&gt; [hash=110,...]</div>
<div class="line">[ 1 ] -&gt; [hash=1,key1=value]</div>
<div class="line">[ 2 ]</div>
<div class="line">[ 3 ] -&gt; [hash=873,key4=value]</div>
<div class="line">[ 4 ] -&gt; [hash=2674,key11=value] -&gt; [hash=214,key5=value]</div>
<div class="line">[ 5 ] -&gt; [hash=8545,key10=value]</div>
<div class="line">[ 6 ] -&gt; [hash=9226,key9=value]</div>
<div class="line">[ 7 ]</div>
<div class="line">[ 8 ] -&gt; [hash=8,key6=value] -&gt; [hash=88,key8=value]</div>
<div class="line">[ 9 ] -&gt; [hash=12439,key7=value]</div>
</div><!-- fragment --><div class="fragment"><div class="line"><span class="comment">// create a hash-table with 10 hash-index range.</span></div>
<div class="line"><span class="comment">// Please be aware, the hash-index range 10 does not mean the number of</span></div>
<div class="line"><span class="comment">// objects which can be stored. You can put as many as you want but if</span></div>
<div class="line"><span class="comment">// this range is too small, hash conflict will happen and fetch time will</span></div>
<div class="line"><span class="comment">// slightly increase.</span></div>
<div class="line">qhashtbl_t *tbl = <a class="code hl_function" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a>(0, QHASHTBL_THREADSAFE);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// put objects into table.</span></div>
<div class="line">tbl-&gt;put(tbl, <span class="stringliteral">&quot;sample1&quot;</span>, <span class="stringliteral">&quot;binary&quot;</span>, 6);</div>
<div class="line">tbl-&gt;putstr(tbl, <span class="stringliteral">&quot;sample2&quot;</span>, <span class="stringliteral">&quot;string&quot;</span>);</div>
<div class="line">tbl-&gt;putint(tbl, <span class="stringliteral">&quot;sample3&quot;</span>, 1);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// debug print out</span></div>
<div class="line">tbl-&gt;debug(tbl, stdout, <span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get objects</span></div>
<div class="line"><span class="keywordtype">void</span> *sample1 = tbl-&gt;get(tbl, <span class="stringliteral">&quot;sample1&quot;</span>, &amp;size, <span class="keyword">true</span>);</div>
<div class="line"><span class="keywordtype">char</span> *sample2 = tbl-&gt;getstr(tbl, <span class="stringliteral">&quot;sample2&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><span class="keywordtype">int</span>  sample3  = tbl-&gt;getint(tbl, <span class="stringliteral">&quot;sample3&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// sample1 is memalloced</span></div>
<div class="line">free(sample1);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// release table</span></div>
<div class="line">tbl-&gt;free(tbl);</div>
<div class="ttc" id="aqhashtbl_8c_html_a7a2314dcb8381b4599e8050becad2268"><div class="ttname"><a href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a></div><div class="ttdeci">qhashtbl_t * qhashtbl(size_t range, int options)</div><div class="ttdoc">Initialize hash table.</div><div class="ttdef"><b>Definition</b> <a href="qhashtbl_8c_source.html#l00127">qhashtbl.c:127</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition in file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a3a9cf947d23f63b5a86e4ab6f815c4fd" name="a3a9cf947d23f63b5a86e4ab6f815c4fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3a9cf947d23f63b5a86e4ab6f815c4fd">&#9670;&#160;</a></span>DEFAULT_INDEX_RANGE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define DEFAULT_INDEX_RANGE&#160;&#160;&#160;(1000)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>default value of hash-index range </p>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00101">101</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a7a2314dcb8381b4599e8050becad2268" name="a7a2314dcb8381b4599e8050becad2268"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7a2314dcb8381b4599e8050becad2268">&#9670;&#160;</a></span>qhashtbl()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">qhashtbl_t * qhashtbl </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>range</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>options</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize hash table. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">range</td><td>initial size of index range. Value of 0 will use default value, DEFAULT_INDEX_RANGE; </td></tr>
    <tr><td class="paramname">options</td><td>combination of initialization options.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced qhashtbl_t, otherwise returns NULL. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>ENOMEM : Memory allocation failure.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><div class="line"><span class="comment">// create a hash-table.</span></div>
<div class="line">qhashtbl_t *basic_hashtbl = <a class="code hl_function" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a>(0, 0);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// create a large hash-table for millions of keys with thread-safe option.</span></div>
<div class="line">qhashtbl_t *small_hashtbl = <a class="code hl_function" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a>(1000000, QHASHTBL_THREADSAFE);</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>Setting the right range is a magic. In practice, pick a value between (total keys / 3) ~ (total keys * 2). Available options:<ul>
<li>QHASHTBL_THREADSAFE - make it thread-safe. </li>
</ul>
</dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00127">127</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="aa156cfc5dbc28dd5c082dbf0d354fd5f" name="aa156cfc5dbc28dd5c082dbf0d354fd5f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa156cfc5dbc28dd5c082dbf0d354fd5f">&#9670;&#160;</a></span>qhashtbl_put()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qhashtbl_put </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;<a class="el" href="qhttpclient_8c.html#ae9ac3bd43c11509c0cbd8fb284bf13eb" title="qhttpclient-&gt;put(): Uploads a file to the remote host using PUT method.">put()</a>: Put an object into this table. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name </td></tr>
    <tr><td class="paramname">data</td><td>data object </td></tr>
    <tr><td class="paramname">size</td><td>size of data object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00198">198</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a8832c9892ab3a4057dcf72589f00685a" name="a8832c9892ab3a4057dcf72589f00685a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8832c9892ab3a4057dcf72589f00685a">&#9670;&#160;</a></span>qhashtbl_putstr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qhashtbl_putstr </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;putstr(): Put a string into this table. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name. </td></tr>
    <tr><td class="paramname">str</td><td>string data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00279">279</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="abfea47ba4675f272f0ecaf5041987f8b" name="abfea47ba4675f272f0ecaf5041987f8b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abfea47ba4675f272f0ecaf5041987f8b">&#9670;&#160;</a></span>qhashtbl_putstrf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qhashtbl_putstrf </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;putstrf(): Put a formatted string into this table. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name. </td></tr>
    <tr><td class="paramname">format</td><td>formatted string data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00295">295</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="ae6a51c2268d057d6de84c0e3b661ba60" name="ae6a51c2268d057d6de84c0e3b661ba60"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae6a51c2268d057d6de84c0e3b661ba60">&#9670;&#160;</a></span>qhashtbl_putint()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qhashtbl_putint </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const int64_t&#160;</td>
          <td class="paramname"><em>num</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;putint(): Put a integer into this table as string type. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name. </td></tr>
    <tr><td class="paramname">num</td><td>integer data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The integer will be converted to a string object and stored as string object. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00323">323</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="adb6639e5a035c6c82d558f75d094bb8a" name="adb6639e5a035c6c82d558f75d094bb8a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb6639e5a035c6c82d558f75d094bb8a">&#9670;&#160;</a></span>qhashtbl_get()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void * qhashtbl_get </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>newmem</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;<a class="el" href="qhttpclient_8c.html#af16a3eb0912e8b5d4896466632d9c843" title="qhttpclient-&gt;get(): Downloads a file from the remote host using GET method.">get()</a>: Get an object from this table. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name. </td></tr>
    <tr><td class="paramname">size</td><td>if not NULL, oject size will be stored. </td></tr>
    <tr><td class="paramname">newmem</td><td>whether or not to allocate memory for the data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of data if the key is found, otherwise returns NULL. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>ENOENT : No such key found.</li>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><div class="line">qhashtbl_t *tbl = <a class="code hl_function" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a>(0, 0);</div>
<div class="line">(...codes...)</div>
<div class="line"> </div>
<div class="line"><span class="comment">// with newmem flag unset</span></div>
<div class="line"><span class="keywordtype">size_t</span> size;</div>
<div class="line"><span class="keywordtype">void</span> *data = (<span class="keyword">struct </span>myobj*)tbl-&gt;get(tbl, <span class="stringliteral">&quot;key_name&quot;</span>, &amp;size, <span class="keyword">false</span>);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// with newmem flag set</span></div>
<div class="line"><span class="keywordtype">size_t</span> size;</div>
<div class="line"><span class="keywordtype">void</span> *data  = (<span class="keyword">struct </span>myobj*)tbl-&gt;get(tbl, <span class="stringliteral">&quot;key_name&quot;</span>, &amp;size, <span class="keyword">true</span>);</div>
<div class="line">free(data);</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>If newmem flag is set, returned data will be malloced and should be deallocated by user. Otherwise returned pointer will point internal buffer directly and should not be de-allocated by user. In thread-safe mode, newmem flag must be set to true always. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00363">363</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="acd67a76b916bb5cd4b0aae2d37b23c9a" name="acd67a76b916bb5cd4b0aae2d37b23c9a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acd67a76b916bb5cd4b0aae2d37b23c9a">&#9670;&#160;</a></span>qhashtbl_getstr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qhashtbl_getstr </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const bool&#160;</td>
          <td class="paramname"><em>newmem</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;getstr(): Finds an object and returns as string type. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name </td></tr>
    <tr><td class="paramname">newmem</td><td>whether or not to allocate memory for the data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of data if the key is found, otherwise returns NULL. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>ENOENT : No such key found.</li>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>If newmem flag is set, returned data will be malloced and should be deallocated by user. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00422">422</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a28ecdb8684c5f059ae179d78e4d4b02a" name="a28ecdb8684c5f059ae179d78e4d4b02a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a28ecdb8684c5f059ae179d78e4d4b02a">&#9670;&#160;</a></span>qhashtbl_getint()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int64_t qhashtbl_getint </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;getint(): Finds an object with given name and returns as integer type. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>value integer if successful, otherwise(not found) returns 0 </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>ENOENT : No such key found.</li>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00439">439</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a0e16876f85af045651b4e14a98760ee6" name="a0e16876f85af045651b4e14a98760ee6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0e16876f85af045651b4e14a98760ee6">&#9670;&#160;</a></span>qhashtbl_remove()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qhashtbl_remove </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;remove(): Remove an object from this table. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">name</td><td>key name</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise(not found) returns false </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>ENOENT : No such key found.</li>
<li>EINVAL : Invalid argument. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00461">461</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a5c30813d4a8dbf3dbb23c394d7799393" name="a5c30813d4a8dbf3dbb23c394d7799393"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5c30813d4a8dbf3dbb23c394d7799393">&#9670;&#160;</a></span>qhashtbl_getnext()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qhashtbl_getnext </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">qhashtbl_obj_t *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const bool&#160;</td>
          <td class="paramname"><em>newmem</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;getnext(): Get next element. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">obj</td><td>found data will be stored in this object </td></tr>
    <tr><td class="paramname">newmem</td><td>whether or not to allocate memory for the data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if found otherwise returns false </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>ENOENT : No next element.</li>
<li>EINVAL : Invalid argument.</li>
<li>ENOMEM : Memory allocation failure.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<div class="fragment"><div class="line">qhashtbl_t *tbl = <a class="code hl_function" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a>(0, 0);</div>
<div class="line">(...add data into list...)</div>
<div class="line"> </div>
<div class="line">qhashtbl_obj_t obj;</div>
<div class="line">memset((<span class="keywordtype">void</span>*)&amp;obj, 0, <span class="keyword">sizeof</span>(obj)); <span class="comment">// must be cleared before call</span></div>
<div class="line">tbl-&gt;lock(tbl);  <span class="comment">// lock it when thread condition is expected</span></div>
<div class="line"><span class="keywordflow">while</span>(tbl-&gt;getnext(tbl, &amp;obj, <span class="keyword">false</span>) == <span class="keyword">true</span>) {  <span class="comment">// newmem is false</span></div>
<div class="line">   printf(<span class="stringliteral">&quot;NAME=%s, DATA=%s, SIZE=%zu\n&quot;</span>,</div>
<div class="line">   obj.name, (<span class="keywordtype">char</span>*)obj.data, obj.size);</div>
<div class="line">   <span class="comment">// do free obj.name and obj.data if newmem was set to true;</span></div>
<div class="line">}</div>
<div class="line">tbl-&gt;unlock(tbl);</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>locking must be provided on user code when all element scan must be guaranteed where multiple threads concurrently update the table. It's ok not to lock the table on the user code even in thread condition, when concurreny is importand and all element scan in a path doesn't need to be guaranteed. In this case, new data inserted during the traversal will be show up in this scan or next scan. Make sure newmem flag is set if deletion is expected during the scan. Object obj should be initialized with 0 by using memset() before first call. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00543">543</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a78ff1327078f1aac4294cad1c4e1953c" name="a78ff1327078f1aac4294cad1c4e1953c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a78ff1327078f1aac4294cad1c4e1953c">&#9670;&#160;</a></span>qhashtbl_size()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t qhashtbl_size </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;size(): Returns the number of keys in this hashtable. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>number of elements stored </dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00613">613</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a26a4dc238b680364bf498e23ec2e1553" name="a26a4dc238b680364bf498e23ec2e1553"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a26a4dc238b680364bf498e23ec2e1553">&#9670;&#160;</a></span>qhashtbl_clear()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void qhashtbl_clear </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;clear(): Clears this hashtable so that it contains no keys. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00622">622</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a166533cb5a45f6d2e458ff36807401f8" name="a166533cb5a45f6d2e458ff36807401f8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a166533cb5a45f6d2e458ff36807401f8">&#9670;&#160;</a></span>qhashtbl_debug()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qhashtbl_debug </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>out</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;debug(): Print hash table for debugging purpose </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
    <tr><td class="paramname">out</td><td>output stream</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false. </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">errno</td><td>will be set in error condition.<ul>
<li>EIO : Invalid output stream. </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00654">654</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a87be8b838dc11139075428254493e8b3" name="a87be8b838dc11139075428254493e8b3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a87be8b838dc11139075428254493e8b3">&#9670;&#160;</a></span>qhashtbl_lock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void qhashtbl_lock </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;lock(): Enter critical section. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>From user side, normally locking operation is only needed when traverse all elements using qhashtbl-&gt;getnext().</dd>
<dd>
This operation will do nothing if QHASHTBL_THREADSAFE option was not given at the initialization time. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00686">686</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a35de9472338a15c45c1e7ffa9935b701" name="a35de9472338a15c45c1e7ffa9935b701"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a35de9472338a15c45c1e7ffa9935b701">&#9670;&#160;</a></span>qhashtbl_unlock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void qhashtbl_unlock </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;unlock(): Leave critical section. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This operation will do nothing if QHASHTBL_THREADSAFE option was not given at the initialization time. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00699">699</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
<a id="a4a71fdf75c0db2e15984195f55b5bc27" name="a4a71fdf75c0db2e15984195f55b5bc27"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4a71fdf75c0db2e15984195f55b5bc27">&#9670;&#160;</a></span>qhashtbl_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void qhashtbl_free </td>
          <td>(</td>
          <td class="paramtype">qhashtbl_t *&#160;</td>
          <td class="paramname"><em>tbl</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>qhashtbl-&gt;free(): De-allocate hash table </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tbl</td><td>qhashtbl_t container pointer. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="qhashtbl_8c_source.html#l00708">708</a> of file <a class="el" href="qhashtbl_8c_source.html">qhashtbl.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_0b61c55142250c0cc363383afd8075a4.html">containers</a></li><li class="navelem"><a class="el" href="qhashtbl_8c.html">qhashtbl.c</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7 </li>
  </ul>
</div>
</body>
</html>
